package dev.alm.cqtakeoutservice.task;

import dev.alm.cqtakeoutservice.websocket.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Slf4j
public class WebSocketTask {

    @Resource
    private WebSocketServer webSocketServer;

    @Scheduled(cron = "0/5 * * * * ?")
    public void sendMessageToAllClients() {
//        log.info("触发 ws 事件");
        webSocketServer.sendMessageToAllClients("hello");
    }
}
